package com.linkdood.app.vm;

import com.linkdood.app.domain.CustomRole;
import com.linkdood.app.domain.Organization;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 用户信息
 * @author hycao
 */
@Data
public class AccountVM {
    private String id;

    /**
     * 账号名称
     */
    private String username;

    /**
     * 系统角色 : SUPERMAN/MANAGER/USER
     */
    private String role;

    private LocalDateTime createTime;
    private LocalDateTime updateTime;

    /**
     * 用户
     */
    private InnerUser user;

    /**
     * 自定义角色
     */
    private CustomRole customRole;

    @Data
    public static class InnerUser {
        private String id;

        /**
         * 第三方系统id
         */
        private String thirdPartyId;

        /**
         * 第三方接入id
         */
        private String sourceId;

        private String displayName;

        private Integer sex;
        private String birthday;
        private String emails;
        private String portraitUrl;

        /**
         * 部门列表
         */
        private List<InnerOrg> org;
    }

    @Data
    public static class InnerOrg {
        private String id;

        /**
         * 部门名称
         */
        private String name;

        /**
         * 部门全称
         */
        private String remark;

        public InnerOrg(Organization organization) {
            this.id = organization.getId();
            this.name = organization.getOrgName();
            this.remark = organization.getRemark();
        }
    }
}
